﻿module MockDisplayElements

open StyleSheets
open StyledElements


let private defaultStyle = readStyle """
 
    color: black;
    font-family: consolas;
    font-size: 20px;

    """ 

type SElement(css:string, children:IStyledNode list) =
    let _style = defaultStyle.updateStyles(readStyle css)
    let _style = ComputedStyle.ComputedStyle(_style.map, (fun ()->None))
    let _children = children
    new (children:IStyledNode list) = SElement("", children)
    interface IStyledElement with
        member this.computedStyle() = _style 
        member this.childNodes with get() = _children
        member this.element with get() = failwith "!"

type SText(css:string, txt:string) =
    let _style = defaultStyle.updateStyles(readStyle css)
    let _style = ComputedStyle.ComputedStyle(_style.map, (fun ()->None))
    new (txt:string) = SText("", txt)
    interface IStyledText with
        member this.computedStyle() = _style   
        member this.element with get() = failwith "!"
        member this.nodeValue = txt

let STextElement(text:string) = SElement("", [SText("", text)])